package cn.buglife.springboot.controller.rest;

import cn.buglife.springboot.bean.Example;
import cn.buglife.springboot.controller.ExampleController;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * 根据模拟资源Example模拟REST风格API
 * <p/>
 * Created by CrazyHarry on 2015/8/5.
 */
@RequestMapping(value = "/example")
@RestController
@EnableAutoConfiguration
public class ExampleRestController {

    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    public Example get(@PathVariable(value = "id") Integer id) {
        Example example = new Example();
        example.setId(id);
        example.setName("example");
        example.setCreateTime(new Date());
        return example;
    }

//    public static void main(String[] args) {
//        SpringApplication.run(ExampleRestController.class, args);
//    }
}
